//
// Created by MikeChen on 2025/4/3.
//  二维数组


#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main() {
    /*
     * 二维数组就是多个相同类型的一维数组的组合
     *
     * */
    int arr1[3][4];
    int arr2[2][5] = {1, 2, 3,};

    //二维数组的定义
    int arr3[][3] = {1, 2, 3, 4, 5, 6, 7};
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            printf("%d\t", arr3[i][j]);
        }
    }

    int arr4[][4] = {0};//全部赋值为0
    int arr5[2][4] = {
            {1, 2, 3},
            {5, 6, 7, 8,}
    };
    int arr6[][3] = {1, 2};//部分赋值

    //二维数组的访问，双下标
    /*int arr7[2][2];
    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
            scanf("%d", &arr7[i][j]);
        }
    }
    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 2; ++j) {
            printf("%d\t", arr7[i][j]);
        }
        printf("\n");
    }*/
    printf("\n");
    //游戏地图设计
    int Map[8][8] = {
            0, 0, 1, 1, 1, 0, 0, 0,
            0, 0, 1, 3, 1, 0, 0, 0,
            0, 0, 1, 0, 1, 1, 1, 1,
            1, 1, 1, 2, 0, 2, 3, 1,
            1, 3, 0, 2, 4, 1, 1, 1,
            1, 1, 1, 1, 2, 1, 0, 0,
            0, 0, 0, 1, 3, 1, 0, 0,
            0, 0, 0, 1, 1, 1, 0, 0
    };

    for (int i = 0; i < 8; ++i) {
        for (int j = 0; j < 8; ++j) {
            switch (Map[i][j]) {
                case 0:
                    printf("  ");//空地⬜
                    break;
                case 1:
                    printf("🔯");//墙壁🔯■
                    break;
                case 2:
                    printf("💣");//箱子
                    break;
                case 3:
                    printf("🐷");//目的地
                    break;
                case 4:
                    printf("🕵️‍♀️️");//人物
                    break;
            }
        }
        printf("\n");
    }
    system("read -rsp $'Press enter to continue...\\n'");
    return EXIT_SUCCESS;
}